Type.registerNamespace("Telerik.Web.UI");
function GetRadSpell(a){return $find(a);
}Telerik.Web.UI.RadSpell=function(a){Telerik.Web.UI.RadSpell.initializeBase(this,[a]);
this._dictionaryLanguage=null;
this._languagesDropDown=null;
this._textSource=null;
this._controlToCheck=null;
this._controlsToCheck=null;
this._ajaxUrl=null;
this._clientTextSource=null;
};
Telerik.Web.UI.RadSpell.prototype={initialize:function(){Telerik.Web.UI.RadSpell.callBaseMethod(this,"initialize");
this._languagesDropDown=this._getChildElement("Language");
this._spellCheckButton=this._getChildElement("SpellCheck");
if(this._spellCheckButton){$addHandlers(this._spellCheckButton,{click:this.startSpellCheck},this);
if(this._spellCheckButton.tagName&&this._spellCheckButton.tagName.toLowerCase()!="input"){$addHandlers(this._spellCheckButton,{keypress:this.startSpellCheck},this);
}}this.set_spellChecked(false);
this.add_clientCheckFinished(this.checkFinishedHandler);
this.add_clientCheckStarted(this.checkStartedHandler);
this.raiseEvent("load",Sys.EventArgs.Empty);
},dispose:function(){this._controlToCheck=null;
this._controlsToCheck=null;
this._dialogOpener=null;
if(this._spellCheckButton){$clearHandlers(this._spellCheckButton);
}this.remove_clientCheckFinished(this.checkFinishedHandler);
this.remove_clientCheckStarted(this.checkStartedHandler);
Telerik.Web.UI.RadSpell.callBaseMethod(this,"dispose");
},checkFinishedHandler:function(a,b){a.set_spellChecked(true);
},checkStartedHandler:function(a,b){a.set_spellChecked(false);
},startSpellCheck:function(){var a=this.get_textSource();
if(a!=null){this.spellCheck(a);
}else{alert("Cannot find a TextSource. Please, set the ControlToCheck server-side property, or use the SetTextSource() client-side method.");
}},spellCheck:function(c){var a=new Sys.CancelEventArgs();
this.raiseEvent("clientCheckStarted",a);
if(!a.get_cancel()){var b={dictionaryLanguage:this.get_selectedLanguage(),textSource:c,spell:this};
this.get_dialogOpener().open("SpellCheckDialog",b);
}},get_selectedLanguage:function(){if(this.get_dictionaryLanguage()){return this.get_dictionaryLanguage();
}if(!this._languagesDropDown){return null;
}var a=this._languagesDropDown.options[this._languagesDropDown.selectedIndex];
return a!=null?a.value:null;
},get_textSource:function(){if(this._textSource==null){if(null!=this.get_controlsToCheck()&&this.get_controlsToCheck().length>0){var a=[];
for(var c=0;
c<this.get_controlsToCheck().length;
c++){a[a.length]=$create(Telerik.Web.UI.Spell.HtmlElementTextSource,{element:$get(this.get_controlsToCheck()[c])},null,null);
}this.set_textSource($create(Telerik.Web.UI.Spell.MultipleHtmlElementsSource,{elements:a},null,null));
}else{if(this.get_controlToCheck()){var b=document.getElementById(this.get_controlToCheck());
this.set_textSource($create(Telerik.Web.UI.Spell.HtmlElementTextSource,{element:b},null,null));
}else{if(this.get_clientTextSource()){this.set_textSource(eval(this.get_clientTextSource()));
}}}}return this._textSource;
},set_textSource:function(a){this._textSource=a;
},get_spellChecked:function(){return this._spellChecked;
},set_spellChecked:function(a){this._spellChecked=a;
var b=$get(this.get_id()+"SpellChecked");
if(b){b.value=a?"true":"";
}},get_dialogOpener:function(){return this._dialogOpener;
},set_dialogOpener:function(a){this._dialogOpener=a;
},get_dictionaryLanguage:function(){return this._dictionaryLanguage;
},set_dictionaryLanguage:function(a){this._dictionaryLanguage=a;
},get_controlToCheck:function(){return this._controlToCheck;
},set_controlToCheck:function(a){this._controlToCheck=a;
},get_controlsToCheck:function(){return this._controlsToCheck;
},set_controlsToCheck:function(a){this._controlsToCheck=a;
},get_clientTextSource:function(){return this._clientTextSource;
},set_clientTextSource:function(a){this._clientTextSource=a;
},get_ajaxUrl:function(){return this._ajaxUrl;
},set_ajaxUrl:function(a){this._ajaxUrl=a;
},get_useClassicDialogs:function(){return this.get_dialogOpener().get_useClassicDialogs();
},set_useClassicDialogs:function(a){this.get_dialogOpener().set_useClassicDialogs(a);
},add_load:function(a){this.get_events().addHandler("load",a);
},remove_load:function(a){this.get_events().removeHandler("load",a);
},add_clientDialogClosing:function(a){this.get_events().addHandler("clientDialogClosing",a);
},remove_clientDialogClosing:function(a){this.get_events().removeHandler("clientDialogClosing",a);
},add_clientCheckCancelled:function(a){this.get_events().addHandler("clientCheckCancelled",a);
},remove_clientCheckCancelled:function(a){this.get_events().removeHandler("clientCheckCancelled",a);
},add_clientCheckFinished:function(a){this.get_events().addHandler("clientCheckFinished",a);
},remove_clientCheckFinished:function(a){this.get_events().removeHandler("clientCheckFinished",a);
},add_clientCheckStarted:function(a){this.get_events().addHandler("clientCheckStarted",a);
},remove_clientCheckStarted:function(a){this.get_events().removeHandler("clientCheckStarted",a);
}};
Telerik.Web.UI.RadSpell.registerClass("Telerik.Web.UI.RadSpell",Telerik.Web.UI.RadWebControl);
Type.registerNamespace("Telerik.Web.UI.Spell");
Telerik.Web.UI.Spell.HtmlElementTextSource=function(a){Telerik.Web.UI.Spell.HtmlElementTextSource.initializeBase(this);
this._element=a;
};
Telerik.Web.UI.Spell.HtmlElementTextSource.prototype={initialize:function(){Telerik.Web.UI.Spell.HtmlElementTextSource.callBaseMethod(this,"initialize");
var a=this.get_element();
if(a==null){alert("Could not find target HTML element. Please verify that ControlToCheck/ControlsToCheck points to valid HTML controls.");
this.set_element({value:""});
}else{if(a.nodeName=="IFRAME"&&a.contentWindow!=null){this.set_element(a.contentWindow.document.body);
}}a=null;
},dispose:function(){this._element=null;
Telerik.Web.UI.Spell.HtmlElementTextSource.callBaseMethod(this,"dispose");
},get_text:function(){var b="";
if(this.get_element().value!=null){try{b=this.get_element().value;
}catch(a){alert("Error getting text from control.\n"+a.message);
}}else{if(this.get_element().innerHTML!=null){try{b=this.get_element().innerHTML;
}catch(a){alert("Error getting HTML from the control.\n"+a.message);
}}else{alert("No value or innerHTML attribute. Cannot access text.");
}}return b;
},set_text:function(a){if(this.get_element()==null){return;
}if(this.get_element().value!=null){this.get_element().value=a;
}else{if(this.get_element().innerHTML!=null){this.get_element().innerHTML=a;
}else{alert("No value or innerHTML attribute. Cannot access text.");
}}},get_element:function(){return this._element;
},set_element:function(a){this._element=a;
}};
Telerik.Web.UI.Spell.HtmlElementTextSource.registerClass("Telerik.Web.UI.Spell.HtmlElementTextSource",Sys.Component);
Telerik.Web.UI.Spell.MultipleHtmlElementsSource=function(a){Telerik.Web.UI.Spell.MultipleHtmlElementsSource.initializeBase(this);
this._elements=a;
};
Telerik.Web.UI.Spell.MultipleHtmlElementsSource.prototype={initialize:function(){Telerik.Web.UI.Spell.MultipleHtmlElementsSource.callBaseMethod(this,"initialize");
},dispose:function(){this._elements=null;
Telerik.Web.UI.Spell.MultipleHtmlElementsSource.callBaseMethod(this,"dispose");
},get_text:function(){var a=[];
for(var b=0;
b<this._elements.length;
b++){a[a.length]=this._elements[b].get_text();
}return a.join("<controlSeparator><br/></controlSeparator>");
},set_text:function(c){var a=c.split("<controlSeparator><br/></controlSeparator>");
for(var b=0;
b<this._elements.length;
b++){this._elements[b].set_text(a[b]);
}},get_elements:function(){return this._elements;
},set_elements:function(a){this._elements=a;
}};
Telerik.Web.UI.Spell.MultipleHtmlElementsSource.registerClass("Telerik.Web.UI.Spell.MultipleHtmlElementsSource",Sys.Component);
